<!DOCTYPE html>
<html>
<head>
  <title>Android to H5 Communication</title>
  <style>
    .contacts{resize: none;}
  </style>
</head>
<body>
<h1>H5 to Android Communication</h1>
<textarea cols="50" rows="10" id="contacts_S3" class="contacts"></textarea>
<button onclick="sendMessageToAndroid_S3()">Send Message to S3</button>
<textarea cols="50" rows="10" id="contacts_S5" class="contacts"></textarea>
<button onclick="sendMessageToAndroid_S5()">Send Message to S5</button>
<h1>Welcome to Tougu!</h1>
<div id="result" >write</div>
<script>
    function sendMessageToAndroid_S3() {
        var value__S3=document.getElementById("contacts_S3").value;
        // 调用Android的方法并传递消息
        if (window.android) {
            window.android.receiveMessageFromS3(value_S3);
        } else {
            windows.print()("请稍后再试（安卓底层交互问题S3）");
        }
    }
</script>
<script>
    function sendMessageToAndroid_S5() {
        var value_S5=document.getElementById("contacts_S5").value;
        // 调用Android的方法并传递消息
        if (window.android) {
            window.android.receiveMessageFromS5(value_S5);
        } else {
            windows.print()("请稍后再试（安卓底层交互问题S5）");
        }
    }
</script>
<script>
    function getFromAndroid(data) {
      var processedData = data
      document.getElementById("result").innerHTML = processedData;
<!--      document.write("Received data from Android:", data);-->
      // Handle the received data as needed
      
    }
    setInterval(getFromAndroid, 10);
</script>
</body>
</html>